﻿using IHISCETeim.BLL;
using IHISCETeim.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace IHISCETeim.Web
{
    public partial class vin : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            //string returnVin = "";
            //VINController.CreateVin("XG000143", out returnVin);
            //Response.Write(returnVin);
            if (!IsPostBack)
            {
               // bindate("");
            }
        }

        protected void btnSeach_Click(object sender, EventArgs e)
        {
                        VIN18VX.Visible = false;
         
                        VIN40NS.Visible = false;
         
                        VIN55NSL.Visible = false;
          
                        VIN68NS.Visible = false;
          
                        VIN80NS.Visible = false;
          
                        VIN100NS.Visible = false;
          
                        VIN100NST.Visible = false;
          
                        VIN135NS.Visible = false;
         


            VinHistoryInfo obj=VINController.GetListByVin(this.txtSer.Text.Trim().ToUpper());
            if (obj.ID <= 0)
            {
                this.Literal1.Text = "请输入正确的环保代码";
                this.showerr.Visible = true;
                this.showvin.Visible = false;
            }
            else
            {
                string sql = " UPPER(VIN) = '"+this.txtSer.Text.Trim().ToUpper()+"'";
                 bindate(sql);
                this.showerr.Visible = false;
                this.showvin.Visible = true;
                //this.VIN.Text = obj.VIN;
                //this.XXGKH.Text = obj.XXGKH;
                //this.SCCDZ.Text = obj.SCCDZ;
                //this.FDJH.Text = obj.FDJH;
                //this.SCDATE.Text = obj.SCDATE;
                //this.CCDATE.Text = obj.CCDATE;
                //this.GKWWW.Text = obj.GKWWW;
                //this.FDJSB.Text = obj.FDJSB;
                //this.FDJSCCDZ.Text = obj.FDJSCCDZ;

                switch (obj.MacType.ToUpper().Trim())
                {
                    case "18VX":
                        VIN18VX.Visible = true;
                        break;
                    case "40NS":
                        VIN40NS.Visible = true;
                        break;
                    case "55NSLGB3":
                        VIN55NSL.Visible = true;
                        break;
                    case "68NSGB3":
                        VIN68NS.Visible = true;
                        break;
                    case "80NSGB3":
                        VIN80NS.Visible = true;
                        break;
                    case "100NSGB3":
                        VIN100NS.Visible = true;
                        break;
                    case "100NSTGB3":
                        VIN100NST.Visible = true;
                        break;
                    case "135NS":
                        VIN135NS.Visible = true;
                        break;
                }

            }
        }

        private void bindate(string sql)
        {
           // string sql = "";
            int TotalCount = 0;
            this.rpMenu.DataSource = VINController.GetPagination(sql, 1, 50, "ID DESC", ref TotalCount);
            this.rpMenu.DataBind();
        }
    }
}